{% extends "dashboard/base.html" %}

{% load trans from i18n %}

{% block title %}{% trans "Dashboard" %}{% endblock %}

{% block scripts %}
  <script type="text/javascript">
    window.confirmDeletionMessage = '{% trans "Are you sure want to delete?" %}';
  </script>
  <script type="text/javascript" src="{{ STATIC_URL }}js/dashboard.js"></script>
{% endblock %}

{% block dashboard_content %}
  <h1>{% trans "All Posts" %}</h1>
  <table class="table table-bordered">
    <thead>
      <tr>
        <th>{% trans "Title" %}</th>
        <th class="date">{% trans "Date" %}</th>
        <th class="is_published">{% trans "Is Published" %}</th>
      </tr>
    </thead>
    <tbody>
      {% for object in object_list %}
        <tr>
          <td>
            <h5>{{ object.title }}</h5>
            <ul class="dashboard-article-menu">
              <li>
                <a href="{% url blog-detail object.slug %}">
                  {% trans "Show" %}
                </a>
              </li>
              <li>
                <a href="{% url dashboard-article-edit object.key %}">
                  {% trans "Edit" %}
                </a>
              </li>
              <li class="dashboard-article-menu-last">
                <a href="{% url dashboard-article-delete object.key %}"
                   class="article-delete">
                  {% trans "Delete" %}
                </a>
              </li>
            </ul>
          </td>
          <td>
            {% with object.created_at as datetime %}
              <time>{{ datetime|date:"d F, Y" }}</time>
              <time>{{ datetime|date:"H:i a" }}</time>
            {% endwith %}
          </td>
          <td>
            <i class="icon-{% if object.is_published %}ok{% else %}remove{% endif %}"></i>
          </td>
        </tr>
      {% empty %}
        <tr>
          <td colspan="3">{% trans "There's no post." %}</td>
        </tr>
      {% endfor %}
    </tbody>
  </table>
{% endblock %}